//-------------------------------------------------------------------------------
//	file debug.h
//	brief
//		TRACE macros for debug (header file)
//
//	$Id: debug.h 3 2014-04-19 07:10:51Z ac.verbeck@gmail.com $
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//	Copyright and Disclaimer Notice
//
//	The MIT License (MIT)
//	
//	Copyright (c) 2014 A.C. Verbeck
//	
//	Permission is hereby granted, free of charge, to any person obtaining a copy
//	of this software and associated documentation files (the "Software"), to deal
//	in the Software without restriction, including without limitation the rights
//	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//	copies of the Software, and to permit persons to whom the Software is
//	furnished to do so, subject to the following conditions:
//	
//	The above copyright notice and this permission notice shall be included in
//	all copies or substantial portions of the Software.
//	
//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//	THE SOFTWARE.
//
//------------------------------------------------------------------------------

typedef enum { INFO, DEBUG, WARNING, CRITICAL } TRACE_LEVEL;

void TRACE_init(bool in);
void _TR(TRACE_LEVEL tr_lvl, const char* file, const char* func, uint16_t line, ...);
void _TR_entry(const char* file, const char* func);
void _TR_exit(const char* file, const char* func);
void ErrorExit(const char* pfunc);

#ifdef BLD_DEBUG
#define TRACE(tl,...)	_TR(tl, __FILE__, __func__, __LINE__, __VA_ARGS__);
#define TRACE_ENTRY()	_TR_entry(__FILE__, __func__);
#define TRACE_EXIT()	_TR_exit(__FILE__, __func__);
#else
#define TRACE(tl,...)	;
#define	TRACE_ENTRY()	;
#define	TRACE_EXIT()	;
#endif

//
//	End: debug.h
//
